Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved Warnings #6

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Resolved Warnings #6

merged 2 commits into from
Oct 30, 2024

Conversation

mephistolist
Copy link

Resolved these warnings:

src/mem.c: In function ‘dbg_realloc’:
src/mem.c:107:5: warning: pointer ‘ptr’ used after ‘realloc’ [-Wuse-after-free]
107 | unlog_ptr(ptr, file, line);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/mem.c:103:20: note: call to ‘realloc’ here
103 | void* newptr = realloc(ptr, size);
| ^~~~~~~~~~~~~~~~~~

src/system.c: In function ‘mvlink’:
src/system.c:212:46: warning: ‘strncat’ specified bound 1 equals source length [-Wstringop-overflow=]
212 | if (new_link[strlen(new_link)-1] != '/') strncat(new_link,"/",1);
| ^~~~~~~~~~~~~~~~~~~~~~~

Fixed this warning:

src/mem.c: In function ‘dbg_realloc’:
src/mem.c:107:5: warning: pointer ‘ptr’ used after ‘realloc’ [-Wuse-after-free]
  107 |     unlog_ptr(ptr, file, line);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/mem.c:103:20: note: call to ‘realloc’ here
  103 |     void* newptr = realloc(ptr, size);
      |                    ^~~~~~~~~~~~~~~~~~
Added some code to resolve this warning:

src/system.c: In function ‘mvlink’:
src/system.c:212:46: warning: ‘strncat’ specified bound 1 equals source length [-Wstringop-overflow=]
  212 |     if (new_link[strlen(new_link)-1] != '/') strncat(new_link,"/",1);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~
@AleksArt000 AleksArt000 merged commit 1e16e2f into Soviet-Linux:main Oct 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants